nice_things/async/timeout.sh
timeout
Since 0.3.0 · Source
import "{ timeout }" from nice_things/async/timeout.sh
Synopsistimeout <time>
Configuration
–
Description
Sleep for <time> seconds, then return with status code 1.
Internally, this function calls the platform's sleep utility. POSIX defines that sleep only accepts an integer number of seconds, so use that for maximum portability. Many implementations also support decimal fractions. Some implementations may support other units beyond seconds by appending a character or word to the <time> argument, or as an extra parameter, but those extensions are not portable.
The timeout function was created to support use-cases of the Future class, to enable racing a timeout against other asynchronous operations, returning an error status code if the timer runs out before the operation completes.
Options
–
Operands<time>: The time in seconds to wait.
Stdin
–
Stdout
–
Stderr
–
Exit status1: Timeout elapsed.
Abort
–
Usage examples
timeout 60